<?php
/**
 * 商品 业务层
 * User: 梁晓伟  lxw11109@gmail.com
 * Date: 2017-09-05
 * Time: 17:58
 */

namespace App\Services\Manager;


use App\Exports\UniversalExport;
use Maatwebsite\Excel\Facades\Excel;

class ExcelService
{
    public function export($data,$fileName)
    {
//        Excel::create($fileName, function ($excel) use ($data, $fileName) {
//            $excel->sheet($fileName, function ($sheet) use ($data) {
//                $sheet->setFontFamily('宋体');
//                $sheet->setAutoSize(true);
//                $sheet->rows($data);
//            });
//        })->store('xls', env("EXCEL_URL"));
        return Excel::download(new UniversalExport($data), $fileName.'.xls');
        return $fileName . ".xls";
    }


}